{% extends 'layout.html' %}
{% block content %}
<div class="container">
<div class="panel panel-success">
    <div class="panel-heading">
        <form class="navbar-form navbar-right" method="get">
            <div class="form-group">
                <input type="text" class="form-control" name="q" placeholder="搜索包含的数字" value="{{search_data}}">
            </div>
            <button type="submit" class="btn btn-primary">
                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
            </button>
        </form>
    </div>
    <div class="panel-body">
        <table class="table table-bordered table-hover">
            <caption>手机列表</caption>
            <thead>
            <tr>
                <th>手机名称</th>
                <th>上市日期</th>
                <th>参数</th>
            </tr>
            </thead>
            <tbody>
            {% for phone in phone_list %}
            <tr>
                <th scope="row">{{phone.手机名称}}</th>
                <td>{{phone.上市日期|date:'Y年m月d日'}}</td>
                <td>
                    <a href="/phone/info/{{phone.手机名称}}" class="btn btn-primary btn-xs"><span
                            class="glyphicon glyphicon-search" aria-hidden="true"></span></a>
                            {% if request.session.info %}
                    &nbsp;&nbsp;
                    <a href="/phone/{{phone.id}}/edit/" class="btn btn-primary btn-xs"><span
                            class="glyphicon glyphicon-edit" aria-hidden="true"></span></a>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
        {% if phone_list|length > 9 %}
        <nav aria-label="Page navigation">
            <ul class="pagination">
                {{page_string}}
            </ul>
        </nav>
        {% endif %}
    </div>
</div>
</div>
{% endblock %}